import http from "./http";

// 首页轮播图接口

export const firstBannerApi = (params) => http.get("/home/banner", params);

// 首页推荐接口
export const firstRecommendApi = (data) => http.post("/home/recommend", data);

// 分类页数据接口
export const classApi = (data) => http.post("/classify", data);

// 详情页数据接口
export const detailApi = (data) => http.post("/detail", data);

// 短信验证码接口
export const getCodeApi = (data) =>
  http.post("/register/getCode", { phone: data.phone, templateId: "537707" });

//注册登录接口
export const loginApi = (data) =>
  http.post("/register", { phone: data.phone, code: data.code });

// 修改个人信息接口
export const updateApi = (data) => http.post("/userinfo/update", data);

// 获取个人信息（用于修改个人信息）
export const getmsgApi = (data) => http.post("/userinfo/get", data);

// 获取收货地址接口
export const getAddressApi = (token) =>
  http.post("/address/get", { token: token });

//新增收货地址接口
export const addAddressApi = (data) =>
  http.post("/address/add", {
    token: data.token,
    getName: data.name,
    getPhone: data.phone,
    address: data.address,
    status: data.status,
  });

// 修改收货地址接口
export const updateAddressApi = (data) => http.post("/address/update", data);

// 获取购物车列表接口
export const shoppingApi = (data) => http.post("/cart/get", data);

// 加入购物车接口
export const addShoppingApi = (data) => http.post("/cart/add", data);
